import { Controller, Get, Query, UseGuards } from "@nestjs/common";
import { Roles } from "src/common/decorators/roles.decorators";
import { RolesGuard } from "src/common/guard/roles.guard";
import { GuardService } from "./guard.service";

@UseGuards(RolesGuard)
@Controller('/guard')
export class GuardController{
  constructor(private readonly roleGuardService: GuardService) {}

  @Get('/1')
  @Roles('admin')
  fetch(@Query() { user }): string {
    return this.roleGuardService.get(user);
  }
}
